home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FishMarket 1.0
/
FishMarket v1.0.iso
/
fishies
/
076-100
/
disk_098
/
thai
/
assigned.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-05-06
|
1KB
|
63 lines
/* Modified from fish 66 */
#include <stdio.h>
#include <exec/types.h>
#include <libraries/dosextens.h>
extern APTR OpenLibrary ();
#define AS_UNKNOWN 0
#define AS_DEVICE 1
#define AS_DIR 2
#define AS_DRIVE 3
int
Assigned(searchname)
char *searchname;
{
struct DosLibrary *DosLibrary;
struct RootNode *RootNode;
struct DosInfo *DosInfo;
struct DeviceList *DevInfo;
char name[256];
char *astr;
BSTR bstr;
long type;
int i,rc;
DosLibrary = (struct DosLibrary *)OpenLibrary("dos.library",0);
RootNode = (struct RootNode *)DosLibrary->dl_Root;
DosInfo = (struct DosInfo *)BADDR(RootNode->rn_Info);
DevInfo = (struct DeviceList *)BADDR(DosInfo->di_DevInfo);
rc = AS_UNKNOWN;
while (DevInfo != NULL) {
type = DevInfo->dl_Type;
bstr = (BSTR)DevInfo->dl_Name;
astr = (char *)BADDR(bstr);
for (i = 0; i < astr[0]; i++)
name[i] = astr[i+1];
name[i] = '\0';
if (strsame(name,searchname)) {
rc = type;
DevInfo = NULL;
}
else
DevInfo = (struct DeviceList *)BADDR(DevInfo->dl_Next);
}
CloseLibrary(DosLibrary);
return(rc);
}
static int
strsame ( s1 , s2 )
register char *s1 , *s2;
{
while ( *s1 != '\0' ) {
if ( mklower ( *s1++ ) != mklower ( *s2++ ) )
return ( FALSE );
}
return ( *s2 == '\0' );
}